package cn.internship.modules.manage.service.impl;

import cn.internship.modules.manage.entity.dto.StudentSearch;
import cn.internship.modules.manage.entity.vo.StudentDetail;
import cn.internship.modules.manage.entity.vo.StudentList;
import cn.internship.modules.manage.entity.vo.WeeklyRecordList;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.internship.common.utils.PageUtils;
import cn.internship.common.utils.Query;

import cn.internship.modules.manage.dao.StudentInfoDao;
import cn.internship.modules.manage.entity.StudentInfoEntity;
import cn.internship.modules.manage.service.StudentInfoService;


@Service("studentInfoService")
public class StudentInfoServiceImpl extends ServiceImpl<StudentInfoDao, StudentInfoEntity> implements StudentInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<StudentInfoEntity> page = this.page(
                new Query<StudentInfoEntity>().getPage(params),
                new QueryWrapper<StudentInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils listByPage(StudentSearch search) {
        Page<StudentList> page=new Page<>(search.getPage(),search.getLimit());
        this.baseMapper.queryList(page,search);
        return  new PageUtils(page);
    }

    @Override
    public StudentDetail getDetail(Integer id) {
        return this.baseMapper.queryDetail(id);
    }

}